#include<bits/stdc++.h>

using namespace std;

#define endl "\n"

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    int Max_Len = 0, length;
    int left, right, l;
    bool flag;
    while (cin >> s) {
        flag = true;
        Max_Len = s.size();
        length = Max_Len;
        while (flag && Max_Len > 1) {
            Max_Len--;
            left = l = 0;
            right = Max_Len;
            while (right < length) {
                while (left < right && s[left] == s[right]) {
                    left++;
                    right--;
                }
                if (left >= right) {
                    Max_Len++;
                    flag = false;
                    break;
                }
                left = ++l;
                right = left + Max_Len;
            }

        }
        cout << Max_Len << endl;
    }

    return 0;
}